def display_max_min(num, scores):
    max_score = max(scores)
    min_score = min(scores)
    print(max_score)
    print(min_score)

num = int(input())

scores = [int(input()) for i in range(num)]

display_max_min(num, scores)
